package soccerBet.project.dao;

import java.util.ArrayList;
import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import soccerBet.project.objects.*;
import soccerBet.project.utils.*;

public class LigaDAO {


	
	public Liga getLigaByJogo(Integer idjogo) {

		Session session = HibernateUtil.getSessionFactory().openSession();
		
		Liga liga = (Liga)  session.
		createQuery("select l from Jogo as j join j.jornada as jorn join jorn.ronda as r join r.epocaLiga as el join el.liga as l where j.idJogo = ?").setInteger(0, idjogo).uniqueResult();
		
		
		session.close();
		
		return liga;

	}








}